package com.hg.order;

import cn.hutool.http.HttpUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @Author: skh
 * @Date: 2019/10/16 15:11
 * @Description:
 */
@Service
@Slf4j
public class OrderService {

    @Autowired
    private OrderDao orderDao;

    @Transactional
    public void insertOrder() {
        OrderDO orderDO = new OrderDO();
        orderDO.setProductId(999);
        orderDO.setAmount(999);
        orderDao.insert(orderDO);

        //调用product服务
        String result = HttpUtil.get("http://192.168.233.150:8081/product/insert");
        System.out.println("result = " + result);
        System.out.println("新增订单成功");

        throw new RuntimeException("");
    }
}
